package com.yule.query;

import org.apache.commons.lang.StringUtils;

import java.util.Date;

public class Query implements Cloneable {

	private int id;

	private String name;

	private String username;

	private String code;

	private String other;

	private boolean isDel;

	private String str1;

	private String str2;

	private String str3;

	private String str4;

	private Integer int1;

	private Integer int2;

	private Integer int3;

	private Integer int4;

	private Integer int5;

	private Integer int6;

	private Integer categoryId;
	
	private Integer deptId;
	
	private Integer stockType;
	
	private Integer packType;
	
	private Integer projectType;

	private Date date1;

	private Date date2;

	private Date date3;

	private Date date4;

	public static final Query getInstance(Query query) {
		Query clone = null;
		try {
			clone = (Query) query.clone();
			if (StringUtils.isNotEmpty(clone.getUsername())) {
				clone.setUsername("%" + clone.getUsername().trim() + "%");
			}
			if (StringUtils.isNotEmpty(clone.getName())) {
				clone.setName("%" + clone.getName().trim() + "%");
			}
			if (StringUtils.isNotEmpty(clone.getCode())) {
				clone.setCode("%" + clone.getCode().trim() + "%");
			}
			if (StringUtils.isNotEmpty(clone.getOther())) {
				clone.setOther("%" + clone.getOther().trim() + "%");
			}
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return clone;
	}

	public Integer getProjectType() {
		return projectType;
	}

	public void setProjectType(Integer projectType) {
		this.projectType = projectType;
	}

	public Integer getDeptId() {
		return deptId;
	}

	public void setDeptId(Integer deptId) {
		this.deptId = deptId;
	}

	public Integer getStockType() {
		return stockType;
	}

	public void setStockType(Integer stockType) {
		this.stockType = stockType;
	}

	public Integer getPackType() {
		return packType;
	}

	public void setPackType(Integer packType) {
		this.packType = packType;
	}

	public Integer getCategoryId() {
		return categoryId;
	}

	public void setCategoryId(Integer categoryId) {
		this.categoryId = categoryId;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public boolean isDel() {
		return isDel;
	}

	public void setDel(boolean del) {
		isDel = del;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getOther() {
		return other;
	}

	public void setOther(String other) {
		this.other = other;
	}

	public String getStr1() {
		return str1;
	}

	public void setStr1(String str1) {
		this.str1 = str1;
	}

	public String getStr2() {
		return str2;
	}

	public void setStr2(String str2) {
		this.str2 = str2;
	}

	public String getStr3() {
		return str3;
	}

	public void setStr3(String str3) {
		this.str3 = str3;
	}

	public String getStr4() {
		return str4;
	}

	public void setStr4(String str4) {
		this.str4 = str4;
	}

	public Integer getInt1() {
		return int1;
	}

	public void setInt1(Integer int1) {
		this.int1 = int1;
	}

	public Integer getInt2() {
		return int2;
	}

	public void setInt2(Integer int2) {
		this.int2 = int2;
	}

	public Integer getInt3() {
		return int3;
	}

	public void setInt3(Integer int3) {
		this.int3 = int3;
	}

	public Integer getInt4() {
		return int4;
	}

	public void setInt4(Integer int4) {
		this.int4 = int4;
	}

	public Integer getInt5() {
		return int5;
	}

	public void setInt5(Integer int5) {
		this.int5 = int5;
	}

	public Integer getInt6() {
		return int6;
	}

	public void setInt6(Integer int6) {
		this.int6 = int6;
	}

	public Date getDate1() {
		return date1;
	}

	public void setDate1(Date date1) {
		this.date1 = date1;
	}

	public Date getDate2() {
		return date2;
	}

	public void setDate2(Date date2) {
		this.date2 = date2;
	}

	public Date getDate3() {
		return date3;
	}

	public void setDate3(Date date3) {
		this.date3 = date3;
	}

	public Date getDate4() {
		return date4;
	}

	public void setDate4(Date date4) {
		this.date4 = date4;
	}
}
